﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WOS.Logging
{
    public sealed class LogLevel
    {
        #region Constants
        public static readonly LogLevel Debug = new LogLevel("DBG", "Debug");
        public static readonly LogLevel Info = new LogLevel("INF", "Info");
        public static readonly LogLevel Warning = new LogLevel("WRN", "Warning");
        public static readonly LogLevel Fatal = new LogLevel("FTL", "Fatal");
        #endregion
        #region Private Fields
        private readonly string code;
        private readonly string name;
        #endregion
        #region Constructors
        private LogLevel(string code, string name)
        {
            this.code = code;
            this.name = name;
        }
        #endregion

        #region Public Members
        public string Code
        {
            get { return this.code; }
        }

        public string Name
        {
            get { return this.name; }
        }
        #endregion
        #region Overridden Members
        public override int GetHashCode()
        {
            return this.code.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var second = obj as LogLevel;

            return second != null && second.Code == this.Code;
        }
        #endregion
    }
}
